<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html ng-app="app" id="ng-app">
<head>
<meta charset="UTF-8">
<title>Link4A&nbsp;在线驱动管理系统</title>
<%@include file="/include/style.jsp" %>
<%@include file="/include/script.jsp" %>
<script type="text/javascript" src="/js/jquery-ui-1.10.0.custom.js"></script>
<script type="text/javascript" src="/js/jquery.layout-latest.min.js"></script>
<link type="text/css" rel="stylesheet" href="/css/page/main.css?v=<%=Constants.VERSION %>" />
<script type="text/javascript">
$(function() {
	$("body").layout({
		north:{
			size:50,
			spacing_open: 0,
			spacing_closed: 0
		},
		west:{
			size:180,
			spacing_open: 1,
			spacing_closed: 1
		}
	});
	
	//选中第一个菜单项
	$($('.menu', '.ui-layout-west')[0]).click();
});

function loadMenu(url, li) {
	$('.current', '.ui-layout-west').removeClass('current');
	$('#mainFrame').attr('src','/'+url);
	$(li).addClass('current');
}
</script>
</head>
<body>
	<div class="ui-layout-north" style="border-bottom: 2px solid #074474">
		<div class="text-logo pull-left">
			<img src="/css/images/logo.png" width="150">
		</div>
		
		<div class="pull-right">
			<i class="fa fa-user"></i>
			${sessionScope._userinfo.user.username}
			<a href="/user/profile" target="mainFrame" class="header-link">
				<i class="fa fa-info-circle"></i>
				个人设置
			</a>
			<a href="/logout" class="header-link">
				<i class="fa fa-sign-out"></i>
				退出
			</a>
		</div>
	</div>
	
	<div class="ui-layout-west">
		<ul>
			<c:forEach items="${sessionScope._userinfo.modules }" var="module">
				<c:if test="${module.menus != null && module.menus.size() > 0}">
					<li id="${ module.name }" class="module">
						<span style="padding-left: 20px;"><i class="${module.style}"></i> ${ module.text }</span>
						<ul>
							<c:forEach items="${ module.menus }" var="menu">
								<li id="${ menu.name }" class="menu" onclick="loadMenu('${menu.url}', this)">${ menu.text }</li>
							</c:forEach>
						</ul>
					</li>
				</c:if>
			</c:forEach>
		</ul>
	</div>
	
	
	<div class="ui-layout-center">
		<iframe height="100%" width="100%" scrolling="auto" frameborder="0" name="mainFrame" id="mainFrame"></iframe>
	</div>
</body>